﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WMSSoft.Lib.Basic;
using WMSSoft.Lib.WinKStart.ViewModel;
using WMSSoft.Lib.WinKStart.Model.MenuConfig;
using WMSSoft.Lib.WinKStart.Extension;

namespace WMSSoft.Lib.WinKStart.Abstract
{
    public abstract class CContextMenuViewModel : CCommandViewModel
    {
        public CSingleCommandViewModel AddRegion { get { return m_oCommands[0]; } }
        public CSingleCommandViewModel Apply { get { return m_oCommands[1]; } }
        public CSingleCommandViewModel DeleteRegion { get { return m_oCommands[2]; } }
        public CSingleCommandViewModel Discard { get { return m_oCommands[3]; } }
        public cWinKStartContextMenuItem ViewData { get; protected set; }

        protected string ContextMenuItemKey { get; set; }

        public CContextMenuViewModel()
        {                                                       
            
            m_oCommands.Add(new CSingleCommandViewModel(LanguageStrings.GetText("Add Region"), new CDelegatingCommand(Delegate => this.ExecuteAddRegion())));
            m_oCommands.Add(new CSingleCommandViewModel(LanguageStrings.GetText("Apply"), new CDelegatingCommand(Delegate => this.ExecuteApplyData())));
            m_oCommands.Add(new CSingleCommandViewModel(LanguageStrings.GetText("Delete Region"), new CDelegatingCommand(Delegate => this.ExecuteDeleteRegion())));
            m_oCommands.Add(new CSingleCommandViewModel(LanguageStrings.GetText("Discard"), new CDelegatingCommand(Delegate => this.ExecuteDiscardData())));            
        }

        /// <summary>
        /// Load Data from Parameter
        /// </summary>
        /// <param name="viewData">Data to load</param>
        public virtual void LoadViewData(string ContextMenuItem)
        {
            ViewData = new cWinKStartContextMenuItem();
        }

        protected virtual void ExecuteAddRegion() {}

        protected virtual void ExecuteDeleteRegion() {}

        protected virtual void ExecuteApplyData() {}

        protected virtual void ExecuteDiscardData() {}
    }
}
